package com.witframework.core;

import java.util.Arrays;

import org.apache.commons.beanutils.MethodUtils;

import com.witframework.core.logic.IBaseService;
import com.witframework.remote.RemoteException;

public class DataService {
	public Object test(Object[] params){
		IBaseService service=WitFrameWork.getSimpleBaseService((String)params[0]);
		try {
			if(params.length>=3)
				return MethodUtils.invokeExactMethod(service,(String)params[1],	Arrays.copyOfRange(params, 2,params.length));
			else
				return MethodUtils.invokeExactMethod(service,(String)params[1],null);
		} catch (Exception e) {			
			throw new RemoteException(e);
		}
	}
	public static void main(String[] a){
		new DataService().test(new Object[]{"user","getAll"});
	}
}